#include "QRWCreateSolidWidget.h"

#include "Core/MainWindow.h"

QRWCreateSolidWidget::QRWCreateSolidWidget(MainWindow* inMainWindow, ShapeOperation* inOperation, QWidget* parent)
    : CreateBaseWidget(inMainWindow, inOperation, parent)
{

}

QRWCreateSolidWidget::~QRWCreateSolidWidget()
{
	delete m_originPoint;
}

void QRWCreateSolidWidget::OnPickPosition(const gp_Pnt& inPosition)
{
	// 处于手动输入模式时，不响应点击事件
	if (ComboBoxIndex == 1)
	{
		return;
	}

	cacheActor = m_mainWindow->UpdateActorPosition(cacheActor, inPosition);
	m_originPoint->SetValue(inPosition);
}

void QRWCreateSolidWidget::OnComboBoxIndexChanged(int index)
{
	// 点选择器模式
	if (index == 0)
	{
		m_originPoint->SetEnable(false);
		ComboBoxIndex = 0;
	}
	// 输入模式
	else if (index == 1)
	{
		m_originPoint->SetEnable(true);
		ComboBoxIndex = 1;
	}
}